home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
graphic
/
disp182a.zip
/
DRVSRC
/
VESA_S3.ASM
< prev
next >
Wrap
Assembly Source File
|
1993-12-06
|
15KB
|
505 lines
;--------------------------------------------------------------------------
; This is file VESA_S3.ASM
;
; Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
; Copyright (C) 1992 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
; Copyright (C) 1992 Shayne Hughes, UC Davis, CA 95616
;
; This file is distributed under the terms listed in the document
; "copying.dj", available from DJ Delorie at the address above.
; A copy of "copying.dj" should accompany this file; if not, a copy
; should be available from where this file was obtained. This file
; may not be distributed without a verbatim copy of "copying.dj".
;
; This file is distributed WITHOUT ANY WARRANTY; without even the implied
; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
;--------------------------------------------------------------------------
; NOTE: this file was formerly called STEALTH.ASM
; It seems that for once the industry is succeeding in manufacturing
; compatible graphics boards, as this driver, orginally written for a
; Diamond Stealth board seems to work unchanged on Orchid F1280 and
; similar S3 based boards, AND EVEN local bus S3 boards.
; Thanks to Shayne Hughes, we now have a paging routine for this
; driver. This allows direct memory access to the video RAM - although
; GRX is not using it.
_TEXT segment byte public 'CODE'
_TEXT ends
DGROUP group _TEXT,_DATA,_BSS
assume cs:_TEXT,ds:DGROUP
_DATA segment word public 'DATA'
d@ label byte
d@w label word
_DATA ends
_BSS segment word public 'BSS'
b@ label byte
b@w label word
_BSS ends
_TEXT segment byte public 'CODE'
assume cs:_TEXT,ds:DGROUP
include grdriver.inc
;--------------------------------------------------------------------------
; DRIVER HEADER
; The following entries MUST match the structure and constant
; declarations in the file 'grdriver.h' of the GRX graphics library
; The mode word should contain the following bitfields:
; - the GRD_NEW_DRIVER bit set for any new format driver
; - the adapter type field should be specified
; - the memory size field should be specified
; - the paging mode field should be specified
; The mode set routine will OR in the plane bitfield as it will
; change when different color number modes are requested.
;--------------------------------------------------------------------------
dw offset mode_set_routine
dw offset paging_routine
mode_W dw GRD_NEW_DRIVER+GRD_VGA+GRD_1024K+GRD_NO_RW
;
; The 'def_xx' fields are filled in by go32 from the corresponding
; fields of the 'GO32' environment variable
;
def_tw dw 80 ; text width
def_th dw 25 ; text height
def_gw dw 320 ; graphics width
def_gh dw 200 ; graphics height
def_nc dw 16 ; graphics colors
dw offset driver_init_routine
dw offset text_mode_table
dw offset graphics_mode_table
;
; Biggest text and graphics sizes
;
Max_TW equ 80
Max_TH equ 50
Max_GWn equ 640 ; non interlaced!!!
Max_GHn equ 480
Max_GW equ 640 ; may be interlaced
Max_GH equ 480
;--------------------------------------------------------------------------
; TABLE OF SUPPORTED TEXT MODES
; - keep sorted by size
; - end with an all 0 entry
; - BIOS field = 0xff disables it
; - fields:
; width, height, colors, BIOS#+ setup_procedure_index*256
;--------------------------------------------------------------------------
text_mode_table label word
dw 80, 25, 2, 007h + 00000h
dw 40, 25, 16, 001h + 00000h
dw 80, 25, 16, 003h + 00000h
dw 80, 28, 16, 003h + 00400h ; 80x25 + reload 14 row font
dw 80, 50, 16, 003h + 00600h ; 80x25 + reload 8 row font
dw 132, 25, 16, 109h + 00000h ; VESA 109h mode
dw 132, 28, 16, 109h + 00400h ; VESA 109h mode (132x25) + reload 14 row font
dw 132, 44, 16, 10ah + 00000h ; VESA 10ah mode
dw 132, 50, 16, 109h + 00600h ; VESA 109h mode (132x25) + reload 8 row font
dw 0, 0, 0, 000h + 00000h
;--------------------------------------------------------------------------
; TABLE OF SUPPORTED GRAPHICS MODES
; - keep sorted first by colors then by size
; - end with an all 0 entry
; - BIOS field = 0xff disables it
; - fields:
; width, height, colors, BIOS#+ setup_procedure_index*256
;--------------------------------------------------------------------------
graphics_mode_table label word
dw 320, 200, 16, 00dh + 00000h
dw 640, 200, 16, 00eh + 00000h
dw 640, 350, 16, 010h + 00000h
dw 640, 480, 16, 012h + 00000h
dw 800, 600, 16, 002h + 00100h ; VESA 102h mode
dw 320, 200, 256, 013h + 00000h
dw 640, 480, 256, 001h + 00200h ; VESA S3 201h mode
dw 800, 600, 256, 003h + 00200h ; VESA S3 203h mode
dw 1024, 768, 256, 005h + 00200h ; VESA S3 205h mode
dw 0, 0, 0, 000h + 00000h
;--------------------------------------------------------------------------
; TABLE OF SPECIAL SETUP PROCEDURES
; You may need such procedures for:
; -- reloading fonts on standard EGA or VGA for
; higher resolution text modes
; -- enable HiColor mode of some Super VGAs
; -- Handle the parameter passing conventions of the VESA BIOS
; -- put VGA into 256 color plane mode ("MODE X")
; -- etc...
; There should be one entry in the table for every non-zero
; 'setup_procedure_index' in the text and graphics mode tables.
; The first entry in the table belongs to index 100h, and so on.
; The special setup procedure is invoked via a near call.
;
; Entry: DI=address of the mode record from the text or graphics
; table to set up.
;
; Exit: Adapter configured
; BX=driver mode word as it should be returned by the mode set
; routine. Typically it involves picking up the mode word
; from the header and OR-ing in the appropriate bitplane mode
; bitfield. (This is not needed for text modes)
; AX, CX, DX, SI can be trashed, PRESERVE DI!!!!
;
; NOTE: This runs in real mode, but don't mess with the segment registers.
;--------------------------------------------------------------------------
special_setup_table label word
dw offset VESA_SVGA_mode_set ; for 01xxh modes
dw offset VESA_S3_mode_set ; for 02xxh accelerated S3 modes
dw 0
dw offset VGA_28_row_mode_set ; for 28 row text modes
dw offset VGA_28_row_mode_set ; for 28 row VESA text modes
dw offset VGA_50_row_mode_set ; for 50 row text modes
dw offset VGA_50_row_mode_set ; for 50 row VESA text modes
;
; Routine to set up VGA 50 row mode
; interface is described above
;
VGA_50_row_mode_set proc near
mov ax,WORD PTR [di+6] ; get base mode number
and ah,1 ; clear setup proc index
je std_50_mode
mov bx,ax
mov ax,4f02h
int 10h
cmp ax,004fh ; VESA error ?
je mode_50_done
mov ax,3 ; VESA error -- set 80x25 mode
std_50_mode:
int 10h
mode_50_done:
xor bx,bx
mov ax,1112h ; load 8x8 font
int 10h
ret
VGA_50_row_mode_set endp
;
; Routine to set up VGA 28 row mode
; interface is described above
;
VGA_28_row_mode_set proc near
mov ax,WORD PTR [di+6] ; get base mode number
and ah,1 ; clear setup proc index
je std_28_mode
mov bx,ax
mov ax,4f02h
int 10h
cmp ax,004fh ; VESA error ?
je mode_28_done
mov ax,3 ; VESA error -- set 80x25 mode
std_28_mode:
int 10h
mode_28_done:
xor bx,bx
mov ax,1111h ; load 8x14 font
int 10h
ret
VGA_28_row_mode_set endp
;
; Routine to set up VESA SVGA modes
; only used for 16 color text and graphics modes
; interface is described above
;
VESA_SVGA_mode_set proc near
mov ax,4f02h
mov bx,WORD PTR [di+6]
int 10h
mov bx,0ffffh ; error code
cmp ax,004fh
jne VESA_SVGA_error
mov bx,mode_W
or bx,GRD_4_PLANES
VESA_SVGA_error:
ret
VESA_SVGA_mode_set endp
; Routine to set up VESA S3 modes
; only used for 256 color graphics modes
; interface is described above
;
VESA_S3_mode_set proc near
mov ax,4f02h
mov bx,WORD PTR [di+6]
int 10h
mov bx,0ffffh ; error code
cmp ax,004fh
jne VESA_S3_error
mov bx,mode_W
xor bx,(GRD_VGA XOR GRD_S3)
or bx,GRD_8_PLANES
VESA_S3_error:
ret
VESA_S3_mode_set endp
;-----------------------------------------------------